From: Julian Sparber Date: Thu, 25 Jan 2024 20:11:50 +0000 (+0100) Subject: FdoNotifications: Only set the title of a Source once X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~60 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c63d67c9af059e8e378af7240bd8e04a5ccd9c98;p=gnome-shell.git FdoNotifications: Only set the title of a Source once Even though the comment in the code says that sources are reused even thought the app title has changed this is actually not the case. Therefore when ever the app title of a notification changes a new `Source` is created. Therefore there is no point in setting the app title again. Part-of: --- diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 4e338bbe7..23d44458c 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -101,10 +101,8 @@ class FdoNotificationDaemon { return ndata.notification.source; let source = this._lookupSource(title, pid); - if (source) { - source.setTitle(title); + if (source) return source; - } const appId = ndata?.hints['desktop-entry']; source = new FdoNotificationDaemonSource(title, pid, sender, appId); @@ -312,10 +310,9 @@ class FdoNotificationDaemonSource extends MessageTray.Source { this.initialTitle = title; this.app = this._getApp(appId); - super._init(title); - - if (this.app) - this.title = this.app.get_name(); + // Use app name as title if available, instead of whatever is provided + // through libnotify (usually garbage) + super._init(this.app ? this.app.get_name() : title); if (sender) { this._nameWatcherId = Gio.DBus.session.watch_name(sender, @@ -376,16 +373,6 @@ class FdoNotificationDaemonSource extends MessageTray.Source { return app; } - setTitle(title) { - // Do nothing if .app is set, we don't want to override the - // app name with whatever is provided through libnotify (usually - // garbage) - if (this.app) - return; - - super.setTitle(title); - } - open() { this.openApp(); this.destroyNonResidentNotifications();